import generateFormItem from './formItem'

export default config => {
  console.log(config)
  let form = ''
  if (config.length > 4) {
    form = `
        <el-form ref="formQuery" :model="formQuery" label-width="100px">
          <drop-pad :data-form="formQuery" @queryFunction="search" @clearFunction="resetForm">
            <div slot="showpad">
              <el-row :gutter="20">
                ${generateFormItem(config.slice(0, 4), 'formQuery')}
              </el-row>
            </div>
            <div slot="hidepad">
                ${generateFormItem(config.slice(4), 'formQuery')}
            </div>
          </drop-pad>
        </el-form>
    `
  } else {
    form = `
        <el-form ref="formQuery" :model="formQuery" label-width="100px">
          <drop-pad :data-form="formQuery" @queryFunction="search" @clearFunction="resetForm">
            <div slot="showpad">
              <el-row :gutter="20">
                ${generateFormItem(config, 'formQuery')}
              </el-row>
            </div>
          </drop-pad>
        </el-form>
    `
  }
  return form
}
